# include <bits/stdc++.h>
using namespace std;

int n;
bool fin[1000];

void dfs(int now) {
    if(now > n) {
        
        return;
    }
    for(int i = 1; i <= n; i++) {
        if(fin[i]) continue;
        fin[i] = 1;
        cout << i;
        dfs(i);
        fin[i] = 0;
    }
}

int main() {
    cin >> n;
    dfs(1);
}